/**
Copyright (c) 2008 Arnaud Fabre <arnaud333@gmail.com>
Copyright (c) 2008 Pierre "delroth" Bourdon <root@delroth.is-a-geek.org>

This file is part of Vos Tutos Offline.

Vos Tutos Offline is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Vos Tutos Offline is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Vos Tutos Offline.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _VTO_DOC_PART_H
#define _VTO_DOC_PART_H

#include <QString>
#include <QDomElement>
#include <QDomDocument>

/** A document with a title */
class TitledDocument
{
	
public:
    TitledDocument(const QString& title = QString());
    const QString& getTitle() const;
    void setTitle(const QString& title);
    const QString& getFilename() const;
    void setFilename(const QString& fname);

    void setDifficult(int d);
    void setProgress(int p);
    void setLicence(int l);

    int getDifficult();
    int getProgress();
    int getLicence();

protected:
    QString title;
    QString filename;
    int difficult;
    int progress;
    int licence;
};

/** A document with content */
class ContentDocument
{
	
public:
    const QString& getContents() const;
    void setContents(const QString& contents);

protected:
    QString contents;
};

/** A tutorial part, which is also used for news items */
class Part : public TitledDocument, public ContentDocument
{
	
public:
    Part(const QString& title = QString());
    Part(const QDomElement& part);
    
    void toFile(const QString& fname);
    void fromFile(const QString& fname);

    void fromDomElement(const QDomElement& part);
    QDomElement toDomElement(QDomDocument& doc) const;
};


/** A document with an introduction and a conclusion */
class IntroducedDocument : public TitledDocument
{
	
public:
    IntroducedDocument(const QString& title = QString());
    ~IntroducedDocument();

    Part* getIntro();
    Part* getConclu();
    Part* getPart(int type);

    void setIntro(const QString& i);
    void setConclu(const QString& c);

protected:
    Part *intro, *conclu;
};

#endif

